﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel;
using System.Configuration;
using System.ServiceModel.Activation;

namespace Communergy.WebApplication.services
{

    public class CommunergyServiceHost : ServiceHost
    {
        public CommunergyServiceHost(Type serviceType, params Uri[] baseAddresses)
            : base(serviceType, baseAddresses)
        { }

        protected override void ApplyConfiguration()
        {
            base.ApplyConfiguration();
        }
    }

    public class CommunergyServiceHostFactory : ServiceHostFactory
    {
        protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
        {
            // Specify the exact URL of your web service
            Uri webServiceAddress = new Uri(ConfigurationManager.AppSettings["ServiceUri"]);

            CommunergyServiceHost webServiceHost = new CommunergyServiceHost(serviceType, webServiceAddress);
            return webServiceHost;
        }
    }
}
